
# encoding:utf-8

import requests
import base64

'''
通用文字识别（高精度含位置版）
'''

request_url = "https://aip.baidubce.com/rest/2.0/ocr/v1/accurate"
# 二进制方式打开图片文件
f = open('C:\\Users\\28438\\Desktop\\图片\\绝缘\\QQ截图20220225205554.png', 'rb')
img = base64.b64encode(f.read())

params = {"image":img}
access_token = '24.cecc5302c9bf36cac2e2d04a778164c6.2592000.1648474599.282335-24068540'
request_url = request_url + "?access_token=" + access_token
headers = {'content-type': 'application/x-www-form-urlencoded'}
response = requests.post(request_url, data=params, headers=headers)
if response:
    print (response.json())

def Hello():
    print("hello, world")
